$OpenBSD: patch-dir_c,v 1.2 2012/03/23 20:59:35 naddy Exp $
--- dir.c.orig	Sat Jul 12 21:19:05 1997
+++ dir.c	Fri Mar 23 21:59:00 2012
@@ -358,8 +358,11 @@ int setdir (struct dir *d, char *dirname)
 
 	d->topfile = d->curfile = 0;
 
-	compdir = d;
-	qsort ((char*)d->cat, (unsigned) d->num, sizeof (d->cat[0]), compfile);
+	if (d->sort != SORTSKIP) {
+		compdir = d;
+		qsort ((char*)d->cat, (unsigned) d->num,
+		    sizeof (d->cat[0]), compfile);
+	}
 
 	if (! dirname) {
 		/* retag files, restore curfile */
